package com.lifesting.front;

import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;

public class DataScroller extends UIComponentBase implements ITableAware {

	private String tableFor; //如果不设定，则为上级MyTable
	public static final String COMPONENT_TYPE = "com.lifesting.datascroller";
    public static final String COMPONENT_FAMILY = "com.lifesting.family";
	@Override
	public String getFamily() {
		return COMPONENT_FAMILY;	
	}

	public String getTableFor() {
		return tableFor;
	}

	public void setTableFor(String tableName) {
		tableFor = tableName;		
	}
	private Object[] values;
	@Override
	public Object saveState(FacesContext context) {
		if (values == null)
		{
			values = new Object[2];
		}
		values[0] = super.saveState(context);
		values[1] = tableFor;
		return values;
	}
	@Override
	public void restoreState(FacesContext context, Object state) {
		values = (Object[]) state;
		super.restoreState(context, values[0]);
		tableFor = (String) values[1];
	}

}
